package com.share.tool.m2d.enums;

import lombok.Getter;

/**
 *
 * @author syq
 * @data 2019/10/10
 */
@Getter
public enum RdsEnum {
    RDS1("京牛web2","172.16.16.49",0,"rds0007","rm-k2ji1s10051r831z7.mysql.zhangbei.rds.aliyuncs.com"),
    RDS2("京牛web1","172.16.16.50",1,"rds0815","rm-k2j25vk3000a16vq6.mysql.zhangbei.rds.aliyuncs.com");

    final private String selfName;
    final private String ip;
    final private Integer instanceId;
    final private String dbNumberName;
    final private String domain;

    private RdsEnum(final String selfName, final String ip,final Integer instanceId, final String dbNumberName, final String domain) {
        this.selfName = selfName;
        this.ip = ip;
        this.instanceId = instanceId;
        this.dbNumberName = dbNumberName;
        this.domain = domain;
    }

    public static RdsEnum toEnumByInstanceId(final Integer instanceId) {
        for (final RdsEnum tag : RdsEnum.values()) {
            if (tag.getInstanceId().equals(instanceId)) {
                return tag;
            }
        }
        return null;
    }
}
